function checkSub(){
	

	var sort1 = document.getElementById('sort1').value;
	var sort2 = document.getElementById('sort2').value;
	var sort3 = document.getElementById('sort3').value;
	var class_attr = document.getElementById('class_attr').value;
	if(class_attr==''){
		if(sort1!=''){
			class_attr += sort1+'|';
			if(sort2!=''){
				class_attr += sort2+'|';
				if(sort3!=''){
					class_attr += sort3+'|';
				}
			}
		}
	}
	
	document.getElementById('class_attr').value = class_attr;

	if(document.getElementById('class_attr').value==''){
		alert('请选择所报科目');
		//document.getElementById('sort1').focus();
		return false;
	}
	
	if(document.getElementById('name').value==''){
		alert('请输入姓名');
		document.getElementById('name').focus();
		return false;
	}
	
	if(document.getElementById('cellphone').value==''){
		alert('请输入手机号');
		document.getElementById('cellphone').focus();
		return false;
	}
	if(!isMobel(document.getElementById('cellphone').value)){
		alert('手机号格式不正确,手机格式如:13888888888');
		document.getElementById('cellphone').focus();
		return false;
	}

	document.addForm.submit();
}

function isMobel(value)
{
     if(/^1\d{10}$/g.test(value)){
             return true;      
     }else{
            return false;      
     }
}

function search(){
	//TODO
	var sort1 = document.getElementById('sort1').value;
	var sort2 = document.getElementById('sort2').value;
	var sort3 = document.getElementById('sort3').value;
	var class_attr = '';
	if(sort1!=''){
		class_attr += sort1+'|';
		if(sort2!=''){
			class_attr += sort2+'|';
			if(sort3!=''){
				class_attr += sort3+'|';
			}
		}
	}
	document.getElementById('req_class_attr').value = class_attr;
	document.indexForm.submit();
}


var type = '10';

function setSecondClass(val) {
	if(document.getElementById('sort1').value == ''){
		document.getElementById('sort2').style.display = 'none';
		document.getElementById('sort3').style.display = 'none';
		document.getElementById('sort1').value = '';
		document.getElementById('sort2').value = '';
		document.getElementById('sort3').value = '';
	}else{
		Ts_categoryInfo.getCatClassByUpId(val, type, setSort2);
	}
}

function setSort2(map_data) {

	var up_class_id = document.getElementById('sort1').value;
	if (map_data != null) {
		Ts_categoryInfo.checkCatSonById(up_class_id,function(ret){
		 if(ret == '1'){
		 }else{
		 	 	DWRUtil.removeAllOptions('sort2');
				DWRUtil.addOptions('sort2',{'':'请选择'});
				DWRUtil.addOptions('sort2', map_data);
				var item = document.getElementById('sort2').length;
				if (item == 0) {
					document.getElementById('sort2').style.display = 'none';
				} else {
					document.getElementById('sort2').style.display = 'inline';
				}
		 }
	 });
	}
}

function setTherdClass(val) {

	Ts_categoryInfo.getCatClassByUpId(val, type, setSort3);
}

function setSort3(map_data) {

	var up_class_id = document.getElementById('sort2').value;

	if (map_data != null) {
		Ts_categoryInfo.checkCatSonById(up_class_id,function(ret){
		 if(ret == '1'){
		 }else{
		 	 	DWRUtil.removeAllOptions('sort3');
				DWRUtil.addOptions('sort3',{'':'请选择'});
				DWRUtil.addOptions('sort3', map_data);
				var item = document.getElementById('sort3').length;
				if (item == 0) {
					document.getElementById('sort3').style.display = 'none';
				} else {
					document.getElementById('sort3').style.display = 'inline';
				}
		 }
	 });
	}
}

function ChangeClassStyle(){
	document.getElementById("class_attr").value = '';
	document.getElementById("classId1").style.display = 'none';
	document.getElementById("classId2").style.display = 'block';
}